package com.study.service.impl;

import com.bus.entity.Goods;
import com.common.DataGridView;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.study.dao.PurChaseDao;
import com.study.entity.PurChase;
import com.study.entity.PurChaseVo;
import com.study.service.PurChaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurChaseServiceImpl implements PurChaseService {
    @Autowired
    PurChaseDao purChaseDao;

    @Override
    public void insert(PurChase purChase) {
        purChaseDao.insert(purChase);
    }

    @Override
    public DataGridView selectAllInport(PurChaseVo purChaseVo) {
//        PageHelper.startPage(purChaseVo.getPage(),purChaseVo.getLimit());
        List<PurChase> inports = purChaseDao.selectAllInport(purChaseVo);
        return new  DataGridView(new PageInfo<>(inports).getTotal(),inports);
    }

    @Override
    public int update(Integer id) {
        return purChaseDao.update(id);
    }

    @Override
    public int CannotUpdate(Integer id) {
        return purChaseDao.CannotUpdate(id);
    }

    @Override
    public int OnceAgain(Integer id) {
        return purChaseDao.OnceAgain(id);
    }
}
